package cn.fengshenghospital.controller;

import cn.fengshenghospital.entity.Menu;
import cn.fengshenghospital.service.MenuService;
import cn.fengshenghospital.vo.JsonBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
//@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;

    @GetMapping("/menu")
    public JsonBean<List<Menu>> queryMenu(Integer id){
        JsonBean<List<Menu>> jsonBean = new JsonBean<>("menu");
        try {
            List<Menu> menuList = menuService.queryMenu(id-1);
            jsonBean.setStatus(200);
            jsonBean.setData(menuList);
        } catch (Exception e) {
            jsonBean.setStatus(-1);
            e.printStackTrace();
        }
        return jsonBean;
    }
















}
